function getCookie(name) {
  var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  if(arr=document.cookie.match(reg))
    return unescape(arr[2]);
  else
    return null;
}
window.onmessage = function(e) {
  if (e.data.type === 'getToken') {
    let token = getCookie('_token');
    // let token = window.localStorage.getItem('_token');
    window.postMessage({
      type: 'pageToken',
      data: token
    }, '*');
  }
}